Method and device for clearing media access control forwarding entry

ABSTRACT

The present application provides a method and a device for clearing a MAC forwarding entry. The method includes: detecting, by a first RB, that a topology of a network accessed by a local terminal changes; and sending, by the first RB, a first packet to a second RB, so that the second RB clears a corresponding forwarding entry after receiving the first packet, where the second RB refers to an RB configured with at least one VLAN the same as that of the first RB.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.14/562,678, filed on Dec. 6, 2014, which is a continuation ofInternational Application No. PCT/CN2013/076691, filed on Jun. 4, 2013,which claims priority to Chinese Patent Application No. 201210186577.7,filed on Jun. 7, 2012. All of the afore-mentioned patent applicationsare hereby incorporated by reference in their entireties.

TECHNICAL FIELD

The present application relates to network communications technologies,and in particular, to a method and a device for clearing a media accesscontrol (MAC) forwarding entry.

BACKGROUND

The Transparent Interconnection of Lots of Links (TRILL) protocol is arouting protocol based on link state computation on a layer 2 network, adevice running the TRILL protocol is referred to as a routing bridgedevice (RB), and a network including RBs is referred to as a TRILLnetwork (TRILL Campus). Large layer 2 networking can be implemented byusing TRILL, which overcomes disadvantages such as low utilization andlong convergence time of a conventional layer 2 network.

A conventional layer 2 native Ethernet can access a TRILL network, andto improve reliability of access to the network, a multi-homing accessmanner is usually used. If a topology of a network accessed by aterminal (End Station, ES) is switched, an RB accessed by a localterminal device may be switched, and if a MAC forwarding entry that ison a remote RB and is used for storing a correspondence between a MACaddress and a nickname of an ingress RB cannot be cleared in time, theremote RB may perform forwarding by using an old MAC forwarding entry,which causes a forwarding failure.

SUMMARY

Embodiments of the present application provide a method and a device forclearing a MAC forwarding entry, which are used to clear a MACforwarding entry in time after a topology of a network accessed by alocal terminal changes, so as to avoid a forwarding failure.

According to one aspect, a method for clearing a MAC forwarding entry isprovided. The method includes detecting, by a first routing bridgedevice (RB) of a first network, a change in a topology of a secondnetwork accessed by a local terminal, the first RB being an edge RB ofthe first network, wherein the second network is connected to the firstnetwork through the first RB. The method also includes sending, by thefirst RB, a first packet to a second RB after detecting the change inthe topology of the second network, wherein the first packet is used toinstruct the second RB to clear a MAC forwarding entry corresponding toa virtual local area network (VLAN) indicated by the first packet,wherein the second RB is configured with at least one VLAN that isconfigured to the first RB. The first packet is sent through an RBridgechannel, and the first packet comprises an Operation, Administration,Maintenance (OAM) channel header and a payload, and wherein the OAMchannel header comprises a channel protocol type indicating that thepayload is one of a topology change notification (TCN) packet, atopology change (TC) packet, and a MAC flush packet.

According to another aspect, a method for clearing a MAC forwardingentry is provided. The method includes receiving, by a second routingbridge (RB), a first packet, wherein the first packet is sent by a firstRB of a first network after the first RB detects a change in a topologyof a second network accessed by a local terminal, wherein the firstpacket is used to instruct the second RB to clear a MAC forwarding entrycorresponding to a virtual local area network (VLAN) indicated by thefirst packet, wherein the second RB is configured with at least one VLANthat is configured to the first RB, wherein the first RB is an edge RBof the first network, wherein the second network is connected to thefirst network through the first RB. The method also includes clearing,by the second RB, the MAC forwarding entry corresponding to the VLANaccording to the first packet. The first packet is sent through anRBridge channel, and the first packet comprises an Operation,Administration, Maintenance (OAM) channel header and a payload, andwherein the OAM channel header comprises a channel protocol typeindicating that the payload is one of a topology change notification(TCN) packet, a topology change (TC) packet, and a MAC flush packet.

According to one aspect, a device for clearing a MAC forwarding entry isprovided. The device includes a processor; and a computer-readablestorage medium storing instructions. The processor is configured toexecute the instructions to implement a method, and the method includesdetecting a change in a topology of a second network accessed by a localterminal. The method also includes sending a first packet to a secondrouting bridge (RB) after detecting the change in the topology of thesecond network, wherein the first packet is used to instruct the secondRB to clear a MAC forwarding entry corresponding to a virtual local areanetwork (VLAN) indicated by the first packet, wherein the first packetis sent through an RBridge channel, and the first packet comprises anOperation, Administration, Maintenance (OAM) channel header and apayload, wherein the OAM channel header comprises a channel protocoltype indicating that the payload is one of a topology changenotification (TCN) packet, a topology change (TC) packet, and a MACflush packet, wherein the second RB is configured with at least one VLANthat is configured to the device, wherein the device is a first RB andin a first network, wherein the device is configured to forward datapackets between the first network and the second network.

According to another aspect, a device for clearing a MAC forwardingentry is provided. The device includes a processor, and acomputer-readable storage medium storing instructions. The processor isconfigured to execute the instructions to implement a method. The methodincludes receiving a first packet sent by a first routing bridge (RB) ina first network after the first RB detects a change in a topology of asecond network accessed by a local terminal, wherein the first packet isused to instruct the device to clear a MAC forwarding entrycorresponding to a virtual local area network (VLAN) indicated by thefirst packet, wherein the first packet is sent through an RBridgechannel, and the first packet comprises an Operation, Administration,Maintenance (OAM) channel header and a payload, wherein the OAM channelheader comprises a channel protocol type indicating that the payload isone of a topology change notification (TCN) packet, a topology change(TC) packet, and a MAC flush packet, wherein the device is configuredwith at least one VLAN that is configured to the first RB, wherein thefirst RB is an edge RB of the first network, wherein the first RB isconfigured to connect the first network to the second network, andclearing the MAC forwarding entry corresponding to the VLAN according tothe first packet.

It can be known from the foregoing technical solutions that, afterdetecting that a topology of a network accessed by a local terminalchanges, a first RB notifies, by using a first packet, a second RB thatthe topology of the network accessed by the local terminal changes, sothat a MAC forwarding entry on the second RB can be cleared quickly, andrapid convergence of TRILL network data traffic can be triggered,thereby ensuring that forwarding is performed smoothly in a dataprocess.

BRIEF DESCRIPTION OF THE DRAWINGS

To describe the technical solutions in the embodiments of the presentapplication more clearly, the following briefly introduces theaccompanying drawings required for describing the embodiments.Apparently, the accompanying drawings in the following description showsome embodiments of the present application, and persons of ordinaryskill in the art may still derive other drawings from these accompanyingdrawings without creative efforts.

FIG. 1 is a schematic flowchart of an embodiment of a method forclearing a MAC forwarding entry according to the present application;

FIG. 2 is a schematic structural diagram of implementing destruction byusing an AF mechanism according to the present application;

FIG. 3 is a schematic structural diagram of implementing destruction bysimulating an STP root bridge by using an edge RB according to thepresent application;

FIG. 4 is a schematic diagram of an encapsulation format of an RBchannel according to the present application;

FIG. 5 is a schematic diagram of another encapsulation format of an RBchannel according to the present application;

FIG. 6 is a schematic flowchart of another embodiment of a method forclearing a MAC forwarding entry according to the present application;

FIG. 7 is a schematic diagram of an initial communication pathcorresponding to FIG. 6;

FIG. 8 is a schematic diagram of a communication path after switchingcorresponding to FIG. 6;

FIG. 9 is a schematic diagram of encapsulation on an RB channelcorresponding to FIG. 6;

FIG. 10 is a schematic flowchart of another embodiment of a method forclearing a MAC forwarding entry according to the present application;

FIG. 11 is a schematic diagram of an initial communication pathcorresponding to FIG. 10;

FIG. 12 is a schematic diagram of a communication path after switchingcorresponding to FIG. 10;

FIG. 13 is a schematic diagram of encapsulation on an RB channelcorresponding to FIG. 10;

FIG. 14 is a schematic structural diagram of an embodiment of a devicefor clearing a MAC forwarding entry according to the presentapplication; and

FIG. 15 is a schematic structural diagram of another embodiment of adevice for clearing a MAC forwarding entry according to the presentapplication.

DETAILED DESCRIPTION OF ILLUSTRATIVE EMBODIMENTS

To make the objectives, technical solutions, and advantages of theembodiments of the present application clearer, the following describesthe technical solutions in the embodiments of the present applicationwith reference to the accompanying drawings in the embodiments of thepresent application. Apparently, the described embodiments are a partrather than all of the embodiments of the present application. All otherembodiments obtained by persons of ordinary skill in the art based onthe embodiments of the present application without creative effortsshall fall within the protection scope of the present application.

FIG. 1 is a schematic flowchart of an embodiment of a method forclearing a MAC forwarding entry according to the present application,and the method includes the following steps.

Block 11: A first RB detects that a topology of a network accessed by alocal terminal changes.

The first RB may refer to an edge RB of a TRILL network. In a case ofmulti-homing networking, to avoid a broadcast storm problem caused bythat multiple ingress RBs all can forward data traffic, access links ofmulti-homing networking may be destroyed, so that a conventional layer 2network can access the TRILL network by using only one access link.

Destruction may be implemented by using an appointed forwarder (AF)mechanism in the TRILL protocol, or, destruction may be implemented bysimulating a Spanning Tree Protocol (STP) root bridge by using an edgeRB, where the STP refers to an STP, a Rapid Spanning Tree Protocol(RSTP), or a Multi-Instance Spanning Tree Protocol (MSTP) in general.

Refer to FIG. 2, which is a schematic structural diagram of implementingdestruction by using an AF mechanism. The TRILL protocol is run betweenan RB1 and an RB3, and message interaction is performed by using a TRILLinteraction packet (which is specifically a TRILL Hello packet); one ofthe RB1 and the RB3 is appointed as a forwarder corresponding to somevirtual local area network (VLAN), and the other RB cannot forward datatraffic in the VLAN; therefore, destruction can be implemented.Referring to FIG. 2, destruction of a link between a bridge device(Bridge) and the RB3 is used as an example.

Refer to FIG. 3, which is a schematic structural diagram of implementingdestruction by simulating an STP root bridge by using an edge RB.Referring to FIG. 3, it is assumed that an RB1 and an RB2 access a sameSTP network, and the RB1 and the RB2 externally present a same bridge IDand bridge priority, where the bridge priority is configured to be thehighest priority. For an accessed STP network below including switchesS1, S2, S3, and S4, the RB1 and the RB2 are equivalent to one rootbridge device, and in this embodiment, a port on the S3 device andconnected to the S2 is blocked, and a port on the S2 device andconnected to the S1 is blocked.

In a scenario of implementing destruction by using the AF mechanism,after an edge RB detects AF switching, specifically, switching from anon-AF to an AF, it can be construed that a topology of a networkaccessed by a local terminal changes. For example, after a link failureoccurs between the RB1 and the bridge device in FIG. 2, an RB accessedby a terminal is switched from the RB1 to the RB3, and in this case, itcan be construed that the topology of the network accessed by the localterminal changes.

In a scenario in which destruction is implemented by simulating an STProot bridge by using an edge RB, when the edge RB receives a topologychange notification (TCN) or a topology change (TC) packet from anaccess port facing a terminal, it can be determined that a topology of anetwork accessed by the terminal changes. Description is made in thefollowing by using the TCN packet as an example. As shown in FIG. 3,initial blocked ports of an STP network accessed by TRILL are on the S2device and the S3 device, and are separately a port located on the S2device and connected to the S1 device, and a port located on the S3device and connected to the S2 device. ES1 to ES5 belong to a same VLAN,and when a fault occurs on a link between the S1 and the S3, the port onthe S3 device and connected to the S2 may change from a blocked state toa forwarding state; in this case, the S3 generates a TCN packet, the TCNpacket is sent to the S2 by using a link between the S3 and the S2, andthen, the S2 sends the TCN packet to the RB2. Therefore, after an accessport of the RB2 receives the TCN packet, it can be determined that thetopology of the network accessed by the local terminal changes.

Block 12: The first RB sends a first packet to a second RB, so that thesecond RB clears a corresponding MAC forwarding entry after receivingthe first packet, where the second RB refers to an RB configured with atleast one VLAN the same as that of the first RB.

After determining that the topology of the network accessed by the localterminal changes, the first RB can send the first packet to the secondRB.

For example, VLANs corresponding to the first RB include a VLAN1 to aVLAN10, and if a VLAN corresponding to an RB other than the first RBincludes at least one of the VLAN1 to the VLAN10, the RB is theforegoing second RB.

Optionally, the first packet may be a MAC flush packet, or a TCN packet.

For example, referring to FIG. 2, in the scenario in which destructionis implemented by using the AF mechanism, the RB3 may send a MAC flushpacket to the RB2; or, referring to FIG. 3, in the scenario in whichdestruction is implemented by simulating the STP root bridge by usingthe edge RB, the RB2 sends a MAC flush packet to the RB3 and an RB4, andthe RB2 sends a TCN packet to the RB1.

The first packet may be sent through a data channel, for example, an RBchannel. The first packet may be sent in a multicast or broadcastmanner; if the multicast manner is used, a destination nickname in aTRILL Header is a nickname of a root of a distribution tree in a TRILLnetwork; if a unicast manner is used, the destination nickname in theTRILL Header is a nickname of a destination-end RB (such as a nicknameof the RB1.).

Specifically, when sending is performed in the multicast manner, allsecond RBs and first RBs need to be on a same distribution tree or asame pruned distribution tree, and the first RB only needs to send onecopy of a MAC flush packet or a TCN packet through a multicast TRILLdata channel corresponding to the distribution tree or the pruneddistribution tree. When sending is performed in the unicast manner, allthe second RBs are obtained in advance by searching a link state database (LSDB) of the whole network, and then, one copy of a MAC flushpacket or a TCN packet is separately sent to each second RB through aunicast TRILL channel. In an example where the RB2 sends the firstpacket, if sending is performed in the multicast manner, the RB2 onlyneeds to send one copy of the first packet; and if the unicast manner isused, the RB2 needs to send one copy of the first packet to each remoteRB device. For the multicast manner for sending, the first packet may besent by using a shared distribution tree, and may also be sent by usinga pruned distribution tree based on a VLAN, which needs to ensure thatall edge RBs to which the first packet needs to be sent are leaf nodesof the distribution tree or the pruned distribution tree.

When the first packet is sent in the unicast manner or in the multicastmanner by using a distribution tree, for an encapsulation format of anRBridge channel, reference may be made to FIG. 4, and the encapsulationformat includes an outer Ethernet header, a Trill header, an innerEthernet header, an OAM channel header, and a payload. Different fromthe prior aft, two new channel protocol types are added to the OAMchannel header, to indicate that a payload part is a TCN packet or a MACflush packet.

When the first packet is sent in the multicast manner by using a pruneddistribution tree, for an encapsulation format of the RBridge channel,reference may be made to FIG. 5. In the example of FIG. 5, all edge RBsto which the first packet needs to be sent join the VLAN 10, and in thiscase, the encapsulation format is equivalent to that in FIG. 4, and aVLAN 10 field needs to be added.

Optionally, the first RB may also send the first packet to each RB in asame VLAN, and in this case, the RB receiving the first packet mayignore and not process the first packet.

The foregoing MAC forwarding entry includes a correspondence between aMAC address of a terminal and a nickname of an ingress RB. The ingressRB is an edge RB for forwarding data traffic, such as the RB1 in FIG. 2or FIG. 3.

In addition, after detecting that the topology of the network accessedby the local terminal changes, the first RB clears a local MACforwarding entry.

In this embodiment, after detecting that a topology of a networkaccessed by a local terminal changes, a first RB notifies, by using afirst packet, a second RB that the topology of the network accessed bythe local terminal changes, so that a MAC forwarding entry on the secondRB device can be cleared quickly, and rapid convergence of TRILL networkdata traffic can be triggered.

FIG. 6 is a schematic flowchart of another embodiment of a method forclearing a MAC forwarding entry according to the present application. Anapplication scenario in this embodiment is: implementing aninterconnection between a conventional layer 2 network and a TRILLnetwork by using an AF mechanism in the TRILL protocol. This embodimentincludes the following steps.

Block 61: Two ESs communicate through an initial communication path.

Referring to FIG. 7, the two ESs are an ES1 and an ES2 separately. Aninitial communication path between the ES2 and the ES1 is:ES2→RB2→RB1→Bridge→ES1, that is, a data packet forwarding path shown bya bold line, and bold lines in subsequent figures have the same meaning.

Block 62: An RB3 detects that AF switching occurs.

For example, AF switching is configured, or is triggered after a linkbetween an RB1 and a Bridge encounters a fault. The RB3 can detect theAF switching.

Block 63: The RB3 sends a MAC flush packet to an RB2, where the packetincludes VLAN information corresponding to an AF obtained after theswitching.

Each RB may determine VLAN information corresponding to the RB, andtherefore, after the AF switching is performed, the AF obtained afterthe switching, for example, the foregoing RB3, may acquire VLANinformation corresponding to the AF obtained after the switching, andadd the VLAN information to a MAC flush packet.

The VLAN information may be a VLAN list or a VLAN bitmap, and in theVLAN bitmap, each bit indicates one VLAN. The VLAN bitmap can save spacecompared with the VLAN list.

To clear a MAC forwarding entry corresponding to a VLAN more precisely,the MAC flush packet may not only include the VLAN information, but alsoinclude one or more MAC addresses or nicknames which are used forinstructing the second RB to clear a MAC forwarding entry matching theVLAN information and the MAC address, or to clear a MAC forwarding entrymatching the VLAN and the nickname, that is, to clear a MAC forwardingentry, which includes the MAC address or the nickname, among all MACforwarding entries corresponding to VLANs indicated by the VLANinformation.

When the MAC flush packet includes VLAN information and a nickname, theMAC flush packet is used for instructing the second RB to clear a MACforwarding entry matching the VLAN and the nickname. In the AFmechanism, the nickname is a nickname of an original RB accessed by alocal terminal, for example, in FIG. 7, the nickname is a nickname of anRB1 device. After the AF is switched from the RB1 to the RB3, the secondRB (RB2) needs to be notified of clearing a MAC entry in which aningress RB is the RB1; in a scenario in which an edge RB simulates anSTP root bridge, for nicknames of all RBs accessing a same STP domain,for example, in FIG. 12, after a topology of an accessed networkchanges, the second RB needs to be notified of clearing MAC entries inwhich ingress RBs are the RB1 and the RB2, and nicknames are nicknamesof the RB1 device and the RB2 device. In this case, the MAC flush packetincludes content: (VLAN1, nickname list), (VLAN2, nickname list), . . .. The second RB only clears MAC forwarding entries, which are inappointed VLANs, learned from the RBs corresponding to the nicknames.

If MAC addresses corresponding to a local terminal that accesses anetwork are clearly known, the MAC flush packet may also be used forinstructing, by specifying VLAN information and MAC addresses, thesecond RB to clear corresponding MAC forwarding entries. In this case,the MAC flush packet includes content: (VLAN1, MAC address list),(VLAN2, MAC address list) . . . . The second RB only clears MACforwarding entries that are in the specified VLANs and include thespecified MAC addresses.

The MAC flush packet may be sent in a data channel, and the data channelmay be an RBridge Channel. Refer to FIG. 9, which is a schematic diagramof a format for sending a MAC flush packet by using a data channel.

In addition, the MAC flush packet may be sent in a unicast or multicastmanner. For a specific format of a data channel used when the unicast ormulticast manner is used, reference may be made to the foregoing FIG. 4or FIG. 5.

Block 64: After receiving the MAC flush packet, the RB2 clears a MACforwarding entry corresponding to the VLAN included in the MAC flushpacket.

Specifically, it may be that a forwarding chip of the RB2 sends the MACflush packet to a control plane of a CPU, and the control plane of theCPU clears a MAC forwarding entry in a corresponding VLAN according tothe VLAN information in the MAC flush packet. For example, a MAC flushpacket includes a VLAN1 and a VLAN2, and after receiving the MAC flushpacket, the RB2 clears a MAC forwarding entry corresponding to the VLAN1and a MAC forwarding entry corresponding to the VLAN2.

Optionally, the RB3 may also send the MAC flush packet to the RB1, andafter receiving the MAC flush packet, the RB1 clears a MAC forwardingentry of a corresponding VLAN. Alternatively, after detecting AFswitching, the RB1 may also clear a MAC forwarding entry of the RB1.Alternatively, the RB1 may also wait until the MAC forwarding entry isaged, so as to clear the MAC forwarding entry.

Further, after the MAC forwarding entry is cleared, a new MAC forwardingentry may be learned in the following manner, so that the MAC forwardingentry is updated in time.

The ES2 sends a unicast data packet to the RB2, and after the RB2receives the layer 2 unicast data packet, because the MAC forwardingentry has been cleared, the RB2 processes the packet as an unknownunicast packet, and sends the packet to the RB1 and the RB3 through adistribution tree.

After receiving the packet, the RB3 performs TRILL decapsulation, learnssource MAC address of the ES2, and then sends the packet to a Bridgethrough an access port. The Bridge also learns the source MAC address ofthe ES2. Then, the Bridge sends the packet to the ES1.

After receiving the unicast data packet of the ES2, the ES1 responds. Aresponse packet reaches the ES2 through a unicast packet forwardingpath, and the forwarding path is ES1→Bridge→RB3→RB2→ES2. The RB2performs source MAC address learning to learn source MAC address of theES1, and a source Nickname is a Nickname of the RB3. Similarly, a bridgedevice may also learn the MAC address of the ES2 and the MAC address ofthe ES1 when the bridge device receives the foregoing unicast datapacket and response packet.

Subsequently, the ES2 and the ES1 can be interconnected by using aunicast process.

In brief, after the AF switching occurs, referring to FIG. 8, acommunication path is switched to be: ES2→RB2→RB3→Bridge→ES1.

In this embodiment, after AF switching is performed, an AF obtainedafter the switching (which is specifically an RB3) sends a MAC flushpacket to a second RB (which is specifically an RB2), and afterreceiving the MAC flush packet, the RB2 clears a MAC forwarding entry,so that a MAC forwarding entry on the RB2 device can be cleared quickly,and rapid convergence of TRILL network data traffic can be triggered.

FIG. 10 is a schematic flowchart of another embodiment of a method forclearing a MAC forwarding entry according to the present application. Anapplication scenario in this embodiment is a scenario in which aninterconnection between an STP network and a TRILL network isimplemented by simulating an STP root bridge by using an edge RB device.This embodiment includes:

Block 101: Two ESs communicate through an initial communication path.

Referring to FIG. 11, initial blocked ports of an STP network accessedby TRILL are on an S2 device and an S3 device, and are separately a portlocated on the S2 device and connected to the S1 device, and a portlocated on the S3 device and connected to the S2 device. ES1 to ES5belong to a same VLAN.

The ES5 communicates with the ES1 through S4→S1→S3, and the ES3communicates with the ES1 through RB3→RB1→S1→S3.

Block 102: A topology of an accessed STP network changes.

When a topology of an accessed STP network changes, for example, a faultoccurs on a link between the S1 and the S3, a blocked port of the S3(S3→S2) is changed to a Forwarding state, and the S3 clears a local MACforwarding entry, generates a TCN packet, and sends the TCN packet tothe S2; after receiving the TCN packet, the S2 clears a local MACforwarding entry, and then sends the TCN packet to the RB2. Afterreceiving the TCN packet, the RB2 sends the TCN packet to an STPprotocol component in the RB2 for processing. The STP protocol componentclears a MAC forwarding entry in a local forwarding chip, sends the TCNpacket to another RB in a same STP domain, and sends a MAC flush packetto another RB that is not in the same STP domain. That is, the RB2 sendsthe TCN packet to the RB1; the RB2 sends the MAC flush packet to the RB3and an RB4, where the MAC flush packet includes VLAN information.

Both the TCN packet and the MAC flush packet can be sent by using anRBridge channel. For a schematic structural diagram of sending a MACflush packet by using an RBridge channel, reference may be made to FIG.9, and for a schematic structural diagram of sending a TCN packet byusing an RBridge channel, reference may be made to FIG. 13.

In addition, it should be noted that, in an STP or RSTP scenario, in theembodiment, clearing a local MAC forwarding entry refers to clearing MACforwarding entries in all VLANs which an access port facing a localterminal joins; in an MSTP scenario, each RB may be corresponding tomultiple MSTP instances, and an RB is locally configured with acorrespondence between MSTP instances and VLANs; a received TCN packetincludes information about an instance. After receiving the TCN packet,the RB can clear a MAC forwarding entry of a VLAN corresponding to theinstance. For another example, in an STP scenario, a TCN packet isreceived, and in an MSTP or RSTP scenario, a TC packet is received.

That is, after block 102, block 103 and block 104 may be included, or,block 105 to block 109 may be included.

Block 103: An RB2 sends a MAC flush packet to an RB3 and an RB4, wherethe MAC flush packet includes VLAN information.

Block 104: After receiving the MAC flush packet, the RB3 and the RB4each clear a MAC forwarding entry corresponding to the VLAN informationincluded in the MAC flush packet.

Block 105: The RB2 sends a TCN packet to an RB1.

Block 106: After receiving the TCN packet, the RB1 clears a local MACforwarding entry.

For example, in the MSTP scenario, after receiving the TCN packet, theRB1 clears a MAC forwarding entry of a VLAN corresponding to an instanceindicated by instance information included in the TCN packet. In the STPor RSTP scenario, after receiving the TCN packet, the RB1 clears MACforwarding entries in all VLANs which the access port facing the localterminal joins, for example, if access VLANs configured on an accessport are VLAN100 to VLAN200, after the TCN packet is received, MACforwarding entries in the VLAN100 to the VLAN200 need to be cleared,where VLANs configured on access ports corresponding to RBs in a sameSTP domain need to the consistent.

After receiving the MAC flush packet, the RB3 and the RB4 each clear theMAC forwarding entry corresponding to the VLAN information included inthe MAC flush packet.

Further, after receiving the TCN packet, the RB1 may further instructanother switch device in the same STP domain to clear a MAC forwardingentry. That is, the method may further include:

Block 107: The RB1 sends the TCN packet to an S1.

Block 108: After receiving the TCN packet, the S1 clears a local MACforwarding entry, and sends the TCN packet to an S4.

Block 109: After receiving the TCN packet, the S4 clears a local MACforwarding entry.

Further, after the MAC forwarding entry is cleared, a new MAC forwardingentry may be learned in the following manner, so that the MAC forwardingentry is updated in time.

A subsequent communication process between the ES3 and the ES1 isprovided in the following descriptions.

The ES3 subsequently communicates with the ES1, and the RB3 receives alayer 2 unicast data packet of the ES3. Because the local MAC entry hasbeen cleared, the layer 2 data packet is used as an unknown unicastpacket and sent to all RB devices, including the RB2 device. The RB2device learns a MAC address of the ES3. At the same time, the RB2 sendsthe packet to the ES1 through an access port, and after the ES1 receivesthe packet, the ES1 responds.

The RB2 receives a response packet of the ES1 from the access port.Because destination MAC address is the MAC address of the ES3, unicastTRILL encapsulation is performed by searching a local MAC forwardingentry, then the packet is sent to the RB3, the RB3 learns a MAC addressof the ES1, and sends the packet to the ES3. Subsequently, communicationbetween the ES3 and the ES1 is performed in a unicast manner, and apacket forwarding path is changed to RB3→RB2→S2→S3 from the originalRB3→RB1→S1→S3.

If the RB3 is not timely notified of an event that the topology of theaccessed STP network changes, the RB3 device still reserves an old MACentry of the ES1, a source Nickname is still a Nickname of the RB1device; in this case, a unicast packet from the ES3 to the ES1 is sentto the RB1 device; however, because a fault occurs on a link from the S1to the S3, the RB1 cannot send the packet to the ES1, thereby causing aforwarding failure. Subsequently, only after a MAC entry on the RB3device is naturally aged, the ES3 can normally communicate with the ES1.The aging time is relatively long, which is generally several minutes.Therefore, by using this solution, TRILL network data forwarding can berapidly converged.

A subsequent communication process between the ES5 and the ES1 is asfollows:

If the ES5 subsequently communicates with the ES1, after the S1 receivesa unicast data packet of the ES5, because a MAC entry on the ES5 hasbeen cleared, the ES5 processes the unicast data packet as an unknownunicast packet, and sends the unknown unicast packet to the RB1.

After the RB1 receives the unicast data packet, because the MACforwarding entry has been cleared, the unicast data packet is processedas an unknown unicast packet. The packet is sent, through a multicastdistribution tree, to all other RBs including the RB2.

After receiving the data packet, the RB2 performs TRILL datadecapsulation, learns source MAC address of the ES5, and then sends thepacket to the S2.

Then, the S2 sends the packet to the S3, and then, the S3 sends thepacket to the ES1.

The ES1 subsequently sends a response packet to the ES5 throughS3→S2→RB2→RB1→S1, the RB1 learns the source MAC address of the ES1, anda source Nickname is a Nickname of the RB2 device. In this way, afterthe topology of the accessed STP network changes, the ES5 can normallycommunicate with the ES1. If the S4 and the S1 do not perceive atopology change event, old MAC entries are still reserved on the S4device and the S1 device, and a packet from the ES5 to the ES1 is sentto the ES1 through S4→S1→S3. However, because a fault occurs on ES1→ES3,a forwarding failure is caused.

For example, referring to FIG. 12, after a topology of an accessednetwork changes, the ES3 eventually communicates with the ES1 throughRB3→RB2→S2→S3.

In this embodiment, when a topology of a network accessed by a localterminal changes, all nodes in a whole TRILL network timely clear MACforwarding entries, so as to timely update MAC forwarding entries,thereby triggering rapid convergence of data forwarding. In addition, inthis embodiment, in a case in which destruction is performed bysimulating an STP root bridge by using a first RB, TCN packets can beflooded to a whole accessed network, so that MAC entries of devices inthe whole accessed network are rapidly cleared, thereby triggering rapidconvergence of accessed network traffic.

FIG. 14 is a schematic structural diagram of an embodiment of a devicefor clearing a MAC forwarding entry according to the presentapplication. The device may be an edge RB of a TRILL network, and thedevice includes a detecting module 141 and a sending module 142. Thedetecting module 141 is configured to detect that a topology of anetwork accessed by a local terminal changes, and the sending module 142is configured to send a first packet to a second RB, so that the secondRB clears a corresponding MAC forwarding entry after receiving the firstpacket, where the second RB refers to an RB configured with at least oneVLAN the same as that of the device.

Optionally, the detecting module is specifically configured to, after itis detected, in an appointed forwarder AF mechanism, that a device isswitched from a non-AF to an AF, determine that the topology of thenetwork accessed by the local terminal changes.

Optionally, the first packet sent by the sending module is a MAC flushpacket, and the MAC flush packet includes VLAN information thatinstructs the second RB to clear a MAC forwarding entry corresponding tothe VLAN information.

Optionally, the MAC flush packet may further include one or more MACaddresses or nicknames that instruct the second RB to clear a MACforwarding entry, which includes the MAC address or nickname, among allMAC forwarding entries corresponding to the VLAN information.

Optionally, the detecting module is specifically configured to, in amechanism in which the first RB simulates an STP root bridge, when a TCNpacket is received from an access port facing the local terminal,determine that the topology of the network accessed by the terminalchanges.

Optionally, the first packet sent by the sending module is a TCN packetthat instructs the second RB to clear a local MAC forwarding entry,where, in an STP or RSTP scenario, the first packet instructs the secondRB to clear MAC forwarding entries in all VLANs which the access portfacing the local terminal joins, and in an MSTP scenario, the firstpacket includes instance information that instructs the second RB toclear a MAC forwarding entry of a VLAN corresponding to the instanceinformation; or, the first packet sent by the sending module is a MACflush packet, where the MAC flush packet includes VLAN information thatinstructs the second RB to clear a MAC forwarding entry corresponding tothe VLAN information.

Optionally, the first packet is sent through a data channel, and thedata channel is an RB channel.

Optionally, the first packet is sent in a multicast manner or a unicastmanner. When sending is performed in the multicast manner, the RBchannel uses a multicast TRILL data packet encapsulation format; whensending is performed in the unicast manner, the RB channel uses aunicast TRILL data packet encapsulation format.

In this embodiment, after a topology of a network accessed by a localterminal changes, a first packet is used to notify a second RB that thetopology of the network accessed by a local terminal changes, so that aMAC forwarding entry on the second RB device can be cleared quickly, andrapid convergence of TRILL network data traffic can be triggered.

FIG. 15 is a schematic structural diagram of another embodiment of adevice for clearing a MAC forwarding entry according to the presentapplication. The device may be a remote RB, and the device includes areceiving module 151 and a processing module 152. The receiving module151 is configured to receive a first packet, where the first packet issent by a first RB after the first RB detects that a topology of anetwork accessed by a local terminal changes; and the processing module152 is configured to clear a corresponding MAC forwarding entryaccording to the first packet.

Optionally, the first packet is a MAC flush packet, where the MAC flushpacket includes VLAN information, and the processing module isspecifically configured to clear a MAC forwarding entry corresponding toa VLAN indicated by the VLAN information.

Optionally, the MAC flush packet may further include one or more MACaddresses or nicknames, and the processing module is specificallyconfigured to clear a MAC forwarding entry, which includes the MACaddress or nickname, among all MAC forwarding entries corresponding toVLANs indicated by the VLAN information.

Optionally, the first packet is a TCN packet, and the processing moduleis specifically configured to, in an STP or RSTP scenario, clear MACforwarding entries in all VLANs which an access port facing the localterminal joins; or, in an MSTP scenario, clear, according to a locallyconfigured correspondence between instances and VLANs and instanceinformation included in the TCN packet, a MAC forwarding entry of a VLANcorresponding to an instance indicated by instance information.

Optionally, the device may further include a sending module, configuredto send the TCN packets to another switch device in a same STP domain,so that the another switch device clears a local MAC forwarding entry.

In this embodiment, after a topology of a network accessed by a localterminal changes, the change is learned by using a first packet and aMAC forwarding entry is cleared, so that a MAC forwarding entry on asecond RB device can be cleared quickly, and rapid convergence of TRILLnetwork data traffic can be triggered.

Persons of ordinary skill in the art may understand that all or a partof the blocks of the method embodiments may be implemented by a programinstructing relevant hardware. The program may be stored in acomputer-readable storage medium. When the program runs, the blocks ofthe method embodiments are performed. The foregoing storage mediumincludes: any medium that can store program code, such as a ROM, a RAM,a magnetic disk, or an optical disc.

Finally, it should be noted that the foregoing embodiments are merelyintended for describing the technical solutions of the presentapplication, but not for limiting the present application. Although thepresent application is described in detail with reference to theforegoing embodiments, persons of ordinary skill in the art shouldunderstand that they may still make modifications to the technicalsolutions described in the foregoing embodiments or make equivalentreplacements to some or all technical features thereof, as long as suchmodifications or replacements do not cause the essence of correspondingtechnical solutions to depart from the scope of the technical solutionsof the embodiments of the present application.

What is claimed is:
 1. A method comprising: detecting, by a firstrouting bridge device (RB) of a first network, a change in a topology ofa second network accessed by a local terminal, the first RB being anedge RB of the first network, wherein the second network is connected tothe first network through the first RB; and sending, by the first RB, afirst packet to a second RB after detecting the change in the topologyof the second network, wherein the first packet is used to instruct thesecond RB to clear a media access control (MAC) forwarding entrycorresponding to a virtual local area network (VLAN) indicated by thefirst packet, and wherein the second RB is configured with at least oneVLAN that is configured to the first RB; and wherein the first packet issent through an RBridge channel, and the first packet comprises anOperation, Administration, Maintenance (OAM) channel header and apayload, and wherein the OAM channel header comprises a channel protocoltype indicating that the payload is a topology change notification (TCN)packet, a topology change (TC) packet, or a MAC flush packet.
 2. Themethod according to claim 1, wherein, in an appointed forwarder (AF)mechanism, detecting the change in the topology comprises detecting, bythe first RB, that the first RB is switched from a non-AF to an AF. 3.The method according to claim 2, wherein the first packet is the MACflush packet, and the MAC flush packet comprises VLAN information thatinstructs the second RB to clear the MAC forwarding entry correspondingto the VLAN information.
 4. The method according to claim 3, wherein theMAC flush packet further comprises: a MAC address of the local terminalthat is used to instruct the second RB to clear the MAC forwardingentry, the MAC forwarding entry corresponding to the VLAN informationand comprising the MAC address; or a nickname of an RB that is used forinstructing the second RB to clear the MAC forwarding entry, the MACforwarding entry corresponding to the VLAN information and comprisingthe nickname.
 5. The method according to claim 1, wherein, in amechanism in which the first RB simulates a Spanning Tree Protocol (STP)root bridge, detecting the change in the topology comprises receiving,by the first RB, a first topology change notification (TCN) packet or afirst topology change (TC) packet from an access port facing the localterminal.
 6. The method according to claim 5, wherein, when the secondRB and the first RB are located in a same STP domain, the first packetis the TCN packet or the TC packet, and the first packet is used toinstruct the second RB to clear a local MAC forwarding entry.
 7. Themethod according to claim 5, wherein the method is applied in at leastone of the following scenarios: an STP scenario, wherein the firstpacket is used to instruct the second RB to clear MAC forwarding entriesin all VLANs which an access port facing the local terminal joins; aRapid Spanning Tree Protocol (RSTP) scenario, wherein the first packetis used to instruct the second RB to clear MAC forwarding entries in allVLANs which an access port connected to the local terminal joins; and aMulti-Instance Spanning Tree Protocol (MSTP) scenario, wherein the firstpacket comprises instance information that instructs the second RB toclear the MAC forwarding entry of the VLAN corresponding to the instanceinformation.
 8. The method according to claim 5, wherein, when thesecond RB is an RB outside an STP domain in which the first RB islocated, the first packet is the MAC flush packet that comprises VLANinformation that instructs the second RB to clear the MAC forwardingentry corresponding to the VLAN information.
 9. The method according toclaim 1, wherein the MAC forwarding entry comprises a correspondencebetween a MAC address of a terminal and a nickname of an ingress RB ofthe first network.
 10. A method comprising: receiving, by a secondrouting bridge (RB), a first packet, wherein the first packet is sent bya first RB of a first network after the first RB detects a change in atopology of a second network accessed by a local terminal, wherein thefirst packet is used to instruct the second RB to clear a media accesscontrol (MAC) forwarding entry corresponding to a virtual local areanetwork (VLAN) indicated by the first packet, wherein the second RB isconfigured with at least one VLAN that is configured to the first RB,wherein the first RB is an edge RB of the first network, and wherein thesecond network is connected to the first network through the first RB;and clearing, by the second RB, the MAC forwarding entry correspondingto the VLAN according to the first packet; and wherein the first packetis sent through an RBridge channel, and the first packet comprises anOperation, Administration, Maintenance (OAM) channel header and apayload, and wherein the OAM channel header comprises a channel protocoltype indicating that the payload is a topology change notification (TCN)packet, a topology change (TC) packet, or a MAC flush packet.
 11. Themethod according to claim 10, wherein the first packet is the MAC flushpacket that comprises VLAN information and wherein clearing the MACforwarding entry comprises clearing the MAC forwarding entrycorresponding to the VLAN indicated by the VLAN information.
 12. Themethod according to claim 11, wherein the MAC flush packet furthercomprises: a MAC address of the local terminal used to clear the MACforwarding entry, the MAC forwarding entry comprising the MAC addressand corresponding to VLANs indicated by the VLAN information; or anickname of an RB used to clear the MAC forwarding entry, the MACforwarding entry comprising the nickname and corresponding to VLANsindicated by the VLAN information.
 13. The method according to claim 10,when the first packet is the topology change notification (TCN) packetor the topology change (TC) packet, further comprising: sending, by thesecond RB, the TCN packet or the TC packet to another switch device in asame STP domain, so that the another switch device clears a local MACforwarding entry.
 14. The method according to claim 10, wherein clearingthe MAC forwarding entry comprises: in a Spanning Tree Protocol (STP)scenario, clearing MAC forwarding entries in all VLANs which an accessport facing the local terminal joins; or in a Rapid Spanning TreeProtocol (RSTP) scenario, clearing MAC forwarding entries in all VLANswhich an access port connected to the local terminal joins; or in aMulti-Instance Spanning Tree Protocol (MSTP) scenario in which the TCNpacket or the TC packet comprises instance information, clearing,according to the instance information and a locally configuredcorrespondence between instances and VLANs, the MAC forwarding entry ofa VLAN corresponding to an instance indicated by the instanceinformation.
 15. A device comprising: a processor; and acomputer-readable storage medium storing instructions; and wherein theprocessor is configured to execute the instructions to implement amethod comprising: detecting a change in a topology of a second networkaccessed by a local terminal; and sending a first packet to a secondrouting bridge (RB) after detecting the change in the topology of thesecond network, wherein the first packet is used to instruct the secondRB to clear a media access control (MAC) forwarding entry correspondingto a virtual local area network (VLAN) indicated by the first packet,wherein the first packet is sent through an RBridge channel, and thefirst packet comprises an Operation, Administration, Maintenance (OAM)channel header and a payload, wherein the OAM channel header comprises achannel protocol type indicating that the payload is a topology changenotification (TCN) packet, a topology change (TC) packet, or a MAC flushpacket, wherein the second RB is configured with at least one VLAN thatis configured to the device, wherein the device is a first RB and in afirst network, and wherein the device is configured to forward datapackets between the first network and the second network.
 16. The deviceaccording to claim 15, wherein detecting the change in the topologycomprises, after detecting, in an appointed forwarder (AF) mechanism,that the device is switched from a non-AF to an AF, determining that thetopology of the second network accessed by the local terminal changes.17. The device according to claim 16, wherein the first packet is theMAC flush packet that comprises VLAN information instructing the secondRB to clear the MAC forwarding entry corresponding to the VLANinformation.
 18. The device according to claim 15, wherein the device isconfigured to operate in at least one of the following scenarios: an STPscenario, wherein the first packet is used to instruct the second RB toclear MAC forwarding entries in all VLANs which an access port facingthe local terminal joins; a Rapid Spanning Tree Protocol (RSTP)scenario, wherein the first packet is used to instruct the second RB toclear MAC forwarding entries in all VLANs which an access port connectedto the local terminal joins; or a Multi-Instance Spanning Tree Protocol(MSTP) scenario, wherein the first packet comprises instance informationthat instructs the second RB to clear the MAC forwarding entry of theVLAN corresponding to the instance information.
 19. A device comprising:a processor; and a computer-readable storage medium storinginstructions; and wherein the processor is configured to execute theinstructions to implement a method comprising: receiving a first packetsent by a first routing bridge (RB) in a first network after the firstRB detects a change in a topology of a second network accessed by alocal terminal, wherein the first packet is used to instruct the deviceto clear a media access control (MAC) forwarding entry corresponding toa virtual local area network (VLAN) indicated by the first packet,wherein the first packet is sent through an RBridge channel, and thefirst packet comprises an Operation, Administration, Maintenance (OAM)channel header and a payload, wherein the OAM channel header comprises achannel protocol type indicating that the payload is a topology changenotification (TCN) packet, a topology change (TC) packet, or a MAC flushpacket, wherein the device is configured with at least one VLAN that isconfigured to the first RB, wherein the first RB is an edge RB of thefirst network, and wherein the first RB is configured to connect thefirst network to the second network; and clearing the MAC forwardingentry corresponding to the VLAN according to the first packet.
 20. Thedevice according to claim 19, wherein the first packet is the MAC flushpacket that comprises virtual local area network (VLAN) information andthe method further comprises clearing the MAC forwarding entrycorresponding to the VLAN indicated by the VLAN information.